home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-07-11 | 1.8 KB | 73 lines | [TEXT/MPS ] |
- #
- # znew.mac -- znew for MPW
- #
- # written by Anthony C. Ard, 1993
- #
- # sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
-
- # Zcmp and zdiff are used to invoke the cmp or the diff pro-
- # gram on compressed files. All options specified are passed
- # directly to cmp or diff. If only 1 file is specified, then
- # the files compared are file1 and an uncompressed file1.gz.
- # If two files are specified, then they are uncompressed (if
- # necessary) and fed to cmp or diff. The exit status from cmp
- # or diff is preserved.
-
- set prog `echo {0} | sed 's|.*/||'`
-
- if "{prog}" =~ /≈cmp/
- set comp compare
- else if "{prog}" =~ /≈diff/
- set comp diff
- end
-
- unset OPTIONS
- unset FILES
- set exit 0
-
- for arg in {Parameters}
- if "{arg}" =~ /-≈/
- set OPTIONS "{OPTIONS} {arg}"
- else
- set FILES "{FILES} {arg}"
- end
- end
-
- if "{FILES}" == ""
- echo "Usage: {prog} [{comp}_options] file [file]"
- exit 1
- end
-
- if {#} == 1
- set FILE `echo "{1}" | sed 's/[-.][zZtga]*$//'`
- gzip -cd "{1}" | {comp} {OPTIONS} "{FILE}"
- set STAT {Status}
- else if {#} == 2
- if "{1}" =~ /≈[-.]gz/ || "{1}" =~ /≈[-.][zZ]/ || "{1}" =~ /≈.t[ga]z/
- if "{2}" =~ /≈[-.]gz/ || "{2}" =~ /≈[-.][zZ]/ || "{2}" =~ /≈.t[ga]z/
- set F `echo "{2}" | sed 's|.*/||;s|[-.][zZtga]*$||'`
- gzip -cd "{2}" > "{TempFolder}{F}"
- gzip -cd "{1}" | {comp} {OPTIONS} "{TempFolder}{F}"
- set STAT {Status}
- delete -y "{TempFolder}{F}"
- else
- gzip -cd "{1}" | {comp} {OPTIONS} "{2}"
- set STAT {Status}
- end
- else
- if "{2}" =~ /≈[-.]gz/ || "{2}" =~ /≈[-.][zZ]/ || "{2}" =~ /≈.t[ga]z/
- gzip -cd "{2}" | {comp} {OPTIONS} "{1}"
- set STAT {Status}
- else
- {comp} {OPTIONS} "{1}" "{2}"
- set STAT {Status}
- end
- end
- else
- echo "Usage: {prog} [{comp}_options] file [file]"
- set STAT 1
- end
-
- set exit 1
- exit {STAT}
-